package main

import (
	"fmt"
	"strconv"
)

func main() {
	//练习golang语言其它类型转换为字符串类型 strconv方法
	var num1 int = 99
	var num2 float64 = 23.456
	var b bool = true
	var myChar byte = 'h'
	var str string
	str = strconv.FormatInt(int64(num1), 10)
	//或者 str = strconv.Itoa(num1)
	fmt.Printf("str type %T str=%q\n", str, str)
	str = strconv.FormatFloat(num2, 'f', 10, 64)
	fmt.Printf("str type %T str=%q\n", str, str)
	str = strconv.FormatBool(b)
	fmt.Printf("str type %T str=%q\n", str, str)
	str = strconv.FormatInt(int64(myChar), 10)
	fmt.Printf("str type %T str=%q\n", str, str)
	// byte转换为字符串
	str = string(myChar)
	fmt.Printf("str type %T str=%q\n", str, str)
}
